<?php
namespace app\dynamic\model;
use app\BaseModel;
class PayQrRecord extends BaseModel
{
    protected $name = 'lb_pay_qr_record';
    public function getlist($page,$list_rows,$where=[]){
        $data = $this
           ->alias( 'a' )
           ->join( 'longbing_card_user b', 'a.user_id = b.id' ,'left')
           ->join( 'longbing_card_user_info c', 'a.staff_id = c.fans_id','left' )
           ->field('b.nickName,b.avatarUrl,c.name,c.avatar,a.update_time,a.create_time ,money,transaction_id')
           ->where($where)
           ->order('a.create_time','desc')
           ->paginate([ 'list_rows' => $list_rows, 'page' => $page ])->toArray();
        $data = transImagesOne($data, ['avatar']);
       return $data;
    }
    public function total_money($where){
        return $this->alias( 'a' )
           ->join( 'longbing_card_user b', 'a.user_id = b.id' ,'left')
           ->join( 'longbing_card_user_info c', 'a.staff_id = c.fans_id','left' )
           ->where($where)
           ->sum('money');
    }
    public function getinfo($where){
       $data = $this->where($where)->order('id desc')->find();
       return $data;
    }
}